package com.huawei.gamebox.service.welfare.gift.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.gamebox.service.common.cardkit.node.BaseGsNode;
import com.huawei.gamebox.service.welfare.gift.bean.PlayerLevelCardBean;
import com.huawei.gamebox.service.welfare.gift.card.PlayLevelCard;
import o.azb;
import o.cgu;
import o.chz;
import o.cih;
import o.exp.j;

public class PlayerLevelSectionNode extends BaseGsNode {
    public PlayerLevelSectionNode(Context context) {
        super(context);
    }

    public void ॱˊ() {
        super.ॱˊ();
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(cgu.ˋ(), -1);
        LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.weight = 1.0f;
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        int ˏ = ˏ();
        for (int i = 0; i < ˏ; i++) {
            if (i != 0) {
                viewGroup.addView(new Space(this.ॱ), layoutParams);
            }
            LinearLayout linearLayout = (LinearLayout) from.inflate(j.ˋˊ, null);
            View ˏ2 = ˏ(from);
            if (ˏ2 != null) {
                linearLayout.addView(ˏ2);
                cih playLevelCard = new PlayLevelCard(this.ॱ);
                playLevelCard.ˏ(ˏ2);
                ˊ(playLevelCard);
            }
            viewGroup.addView(linearLayout, layoutParams2);
        }
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        int ˏ = ˏ();
        this.ˏ = o_chz.ˏ;
        for (int i = 0; i < ˏ; i++) {
            cih ˎ = ˎ(i);
            if (ˎ instanceof PlayLevelCard) {
                CardBean ˋ = o_chz.ˋ(i);
                if (ˋ instanceof PlayerLevelCardBean) {
                    ˎ.ˎ((PlayerLevelCardBean) ˋ, viewGroup);
                    ˎ.ˉ().setVisibility(0);
                } else {
                    ˎ.ˉ().setVisibility(8);
                }
            }
        }
        return true;
    }

    private View ˏ(LayoutInflater layoutInflater) {
        if (layoutInflater == null) {
            return null;
        }
        int i = j.ͺॱ;
        if (ˋ()) {
            i = j.ˊॱ;
        }
        RelativeLayout relativeLayout = (RelativeLayout) layoutInflater.inflate(i, null);
        if (ˋ()) {
            return relativeLayout;
        }
        azb.ˏ(relativeLayout);
        return relativeLayout;
    }

    public void ॱˎ() {
        super.ॱˎ();
        ˎ();
    }

    private void ˎ() {
        for (int i = 0; i < ˏ(); i++) {
            cih ˎ = ˎ(i);
            if (ˎ instanceof PlayLevelCard) {
                ((PlayLevelCard) ˎ).ˊ();
            }
        }
    }
}
